const Router = require('koa-router')
const router = new Router()
const koaBody = require('koa-bodyparser');

const ed = require('../model/contri');

router.prefix('/editor');

router.post('/add',koaBody(),async ctx=>{
    //获取投稿题目所获得的信息
    const subject = ctx.request.body.subject;
    const optionA = ctx.request.body.optionA;
    const optionB = ctx.request.body.optionB;
    const optionC = ctx.request.body.optionC;
    const optionD = ctx.request.body.optionD;
    const right_key = ctx.request.body.right_key;
    const attribute = ctx.request.body.attribute;
    const provider = ctx.request.body.username;
    
    const rows = await ed.ADDTOPIC(subject,optionA,optionB,optionC,optionD,right_key,attribute,provider);

    ctx.body = rows;
})

module.exports = router